<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>服务器 - Server</title>
<!--{include file="common.head.include.tpl"}-->
	</head>
	<body>
<!--{include file="common.head.tpl"}-->
		<!--{if $userid>0}-->
		<p style="font-size:20px;font-weight:bold;">服务器列表</p>
		<p style="font-size:12px;"><a id="gozabbix" href="./ajaxproxy.php?height=600&width=1000&type=serverhtml&get=zabbix" class="thickbox" title="Zabbix Monitor">GO Zabbix Monitor</a></p>
		<script type="text/javascript">
			var eventcache=new Array();
			function isInCache(eventid){
				for(i=0;i<eventcache.length;++i)
				{
					if(eventcache[i]==eventid)
					{
						return true;
					}
				}
				return false;
			}
			function zabbix_pagemonitorloop(){
				if(document.getElementById('zabbix_container')!=null)
				{
					return ;
				}
				$.get('ajaxproxy.php','type=zabbixEvents',function(data){
					for(i=0;i<data.eventids.length;++i)
					{
						if(!isInCache(data.eventids[i]))
						{
							document.getElementById('gozabbix').click();
						}
					}
				},'json');
			}
			function zabbix_monitorloop(){
				if(document.getElementById('zabbix_container')==null)
				{
					
					return ;
				}
				$.get('ajaxproxy.php','type=zabbixEvents',function(data){
					for(j=0;j<data.length;++j)
					{
						for(i=0;i<data[j].data.eventids.length;++i)
						{
							if(!isInCache(data[j].data.eventids[i]))
							{
								eventcache.push(data[j].data.eventids[i]);
							}
							newhtml='<table style=\"font-size:15px;\"><tr style=\"font-weight:bold;\"><td>EventID</td><td>Hostname</td><td>Event</td><td>Duration</td><td>Ack</td></tr>';
							for(i=0;i<data[j].data.events.length;++i)
							{
								newhtml+='<tr><td>'+data[j].prefix+data[j].data.eventids[i]+'</td><td>'+data[j].data.events[i][0]+'</td><td>'+data[j].data.events[i][1]+'</td><td>'+data[j].data.events[i][2]+'</td><td>'+data[j].data.events[i][3]+'</td></tr>'
							}
							newhtml+='</table>';
							document.getElementById('zabbix_container').innerHTML=newhtml;
						}
					}
				},'json');
			}
			var z1=setInterval('zabbix_pagemonitorloop()',10000);
			var z2=setInterval('zabbix_monitorloop()',10000);
		</script>
		<table class="serverList">
			<tr class="serverListRows serverListTitle"><td>IP</td><td>Hostname</td><td>Last Check</td><td>Status</td><td>More</td></tr>
			<!--{section name=servers loop=$servers}--> 
			<tr class="serverListRows serverstat<!--{$servers[servers]->laststat}-->">
				<td><!--{section name=serverips loop=$servers[servers]->ipaddrs}--><!--{$servers[servers]->ipaddrs[serverips]}--><!--{if $smarty.section.serverips.last != 1}--><br /><!--{/if}--><!--{/section}--></td>
				<td><!--{$servers[servers]->hostname|truncate:20:"...":true}--></td>
				<td><!--{$servers[servers]->lastcheck}--></td>
				<td><!--{if $servers[servers]->laststat == "Alive"}--><img src="images/ico_32_okay.jpg" alt=""/><!--{elseif $servers[servers]->laststat == "Down"}--><img src="images/ico_32_down.jpg" alt=""/><!--{elseif $servers[servers]->laststat == "Fail"}--><img src="images/ico_32_error.jpg" alt=""/><!--{else}--><img src="images/ico_32_warning.jpg" alt=""/><!--{/if}--><br /><!--{$servers[servers]->laststat}--></td>
				<td><a href="./ajaxproxy.php?type=serverhtml&get=detail&id=<!--{$servers[servers]->id}-->" title="Server Detail: [<!--{$servers[servers]->hostname|truncate:40:"...":true}-->]" class="thickbox">detail</a></td>
			</tr><!--{/section}-->
		</table>
		<!--{else}-->
		<p></p>
		<!--{/if}-->
<!--{include file="common.foot.tpl"}-->
	</body>
</html>
